<include file="public/layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <div class="subject">
        <h3>分销商品管理</h3>
        <h5>商城分销商品管理</h5>
      </div>
    </div>
  </div>
  <!-- 操作说明 -->
  <div id="explanation" class="explanation" style="color: rgb(44, 188, 163); background-color: rgb(237, 251, 248); width: 99%; height: 100%;">
    <div id="checkZoom" class="title"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span title="收起提示" id="explanationZoom" style="display: block;"></span>
    </div>
    <ul>
		<li>参与分销的商品在此列表显示</li>
	</ul>
  </div>
    <div class="flexigrid">
        <div class="mDiv">
            <div class="ftitle">
                <h3>分销商品列表</h3>
                <h5>(共{$pager->totalRows}条记录)</h5>
            </div>
            <div title="刷新数据" class="pReload"><i class="fa fa-refresh"></i></div>
            <form action="{:U('Distribut/goods_list')}" id="search-form2" class="navbar-form form-inline" method="get">
                <div class="sDiv">
                    <div class="sDiv2" style="margin-right: 10px;border: none;">
                        <select name="cat_id" id="cat_id">
                            <option value="">所有分类</option>
                            <foreach name="categoryList" item="v" key="k">
                                <option value="{$v['id']}"> {$v['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="sDiv2" style="margin-right: 10px;border: none;">
                        <select name="brand_id" id="brand_id">
                            <option value="">所有品牌</option>
                            <foreach name="brandList" item="v" key="k">
                                <option value="{$v['id']}">{$v['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <div class="sDiv2">
                        <input type="text" size="30" name="key_word" class="qsbox" placeholder="商品名称或者货号...">
                        <input type="submit" class="btn" value="搜索">
                    </div>
                </div>
            </form>
        </div>
        <div class="hDiv">
          <div class="hDivBox">
            <table cellspacing="0" cellpadding="0">
              <thead>
                <tr>
                  <th class="sign" axis="col6">
                    <div style="width: 24px;"><i class="ico-check"></i></div>
                  </th>
                  <th align="left" abbr="article_title" axis="col6" class="">
                    <div style="text-align: left; width:50px;" class="">ID</div>
                  </th>
                  <th align="left" abbr="ac_id" axis="col4" class="">
                    <div style="text-align: left; width: 300px;" class="">商品名称</div>
                  </th>
                  <th align="center" abbr="article_show" axis="col6" class="">
                    <div style="text-align: center; width: 50px;" class="">销量</div>
                  </th>
                  <th align="left" abbr="article_time" axis="col6" class="">
                    <div style="text-align: left; width: 200px;" class="" >分类</div>
                  </th>
                  <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 50px;" class="" >价格</div>
                  </th>
                  <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 50px;" class="">库存</div>
                  </th>
                  <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 50px;" class="">分成金额</div>
                  </th>
                  <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 80px;" class="">占商品价格比</div>
                  </th>
                  <th align="center" abbr="article_time" axis="col6" class="">
                    <div style="text-align: center; width: 50px;">操作</div>
                  </th>
                  <th style="width:100%" axis="col7">
                    <div></div>
                  </th>
                </tr>
              </thead>
            </table>
          </div>
        </div>
        <div class="bDiv" style="height: auto;">
         <!--ajax 返回 -->
            <table>
                <tbody>
                <volist name="goodsList" id="list">
                    <tr>
                        <td class="sign" axis="col6">
                            <div style="width: 24px;"><i class="ico-check"></i></div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="width: 50px;">{$list.goods_id}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: left; width: 300px;">{$list.goods_name|getSubstr=0,33}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: center; width: 50px;">{$list.sales_sum}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: left; width: 200px;">{$catList[$list[cat_id]][name]}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: center; width: 50px;">{$list.shop_price}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: center; width: 50px;">{$list.store_count}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: center; width: 50px;">{$list.commission}</div>
                        </td>
                        <td align="center" axis="col0">
                            <div style="text-align: center; width: 80px;">{$list['commission']/$list['shop_price']*100|round=2}%</div>
                        </td>
                        <td align="center" class="handle">
                            <div style="text-align: center; width: 170px; max-width:170px;">
                                <a href="{:U('Home/Goods/goodsInfo',array('id'=>$list['goods_id']))}" target="_blank" class="btn blue"><i class="fa fa-search"></i>查看</a>
                                <a href="{:U('Admin/Goods/addEditGoods',array('id'=>$list['goods_id'],'is_distribut'=>1))}" class="btn blue"><i class="fa fa-pencil-square-o"></i>编辑</a>
                                <a class="btn red"  href="javascript:void(0)" onclick="del('{$list[goods_id]}')"><i class="fa fa-trash-o"></i>删除</a>
                            </div>
                        </td>
                        <td align="" class="" style="width: 100%;">
                            <div>&nbsp;</div>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
          {$page}
    </div>
</div>
<script>
    $(document).ready(function(){
        // 表格行点击选中切换
        $('#flexigrid > table>tbody >tr').click(function(){
            $(this).toggleClass('trSelected');
        });

        // 点击刷新数据
        $('.fa-refresh').click(function(){
            location.href = location.href;
        });
    });
    // 删除操作
    function del(id) {
        layer.confirm('确定要删除吗?', {
                    btn: ['确定', '取消'] //按钮
                }, function () {
                    // 确定
                    $.ajax({
                        url: "/index.php?m=Admin&c=goods&a=delGoods&ids=" + id,
                        success: function (v) {
                            layer.closeAll();
                            var v = eval('(' + v + ')');
                            if (v.hasOwnProperty('status') && (v.status == 1)){
                                window.location.reload()
                            }else{
                                layer.msg(v.msg, {icon: 2, time: 1000}); //alert(v.msg);
                            }
                        }
                    });
                }, function (index) {
                    layer.close(index);
                }
        );
    }
</script>
</body>
</html>